public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MonthSche frm = new MonthSche();
            frm.MdiParent = this;
            frm.Show();
            frm.WindowState = FormWindowState.Maximized;
        }

        private void staffToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Staff frm = new Staff();
            frm.MdiParent = this;
            frm.Show();
        }

        private void scheduleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Schedule frm = new Schedule();
            frm.MdiParent = this;
            frm.Show();
        }

        private void attendanceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Attendance frm = new Attendance();
            frm.MdiParent = this;
            frm.Show();
        }

        private void atteKindtoolStripMenuItem_Click(object sender, EventArgs e)
        {
            AtteKind frm = new AtteKind();
            frm.MdiParent = this;
            frm.Show();
        }

        private void wageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Wages frm = new Wages();
            frm.MdiParent = this;
            frm.Show();
        }

        private void setBaseWageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BaseWage frm = new BaseWage();
            frm.MdiParent = this;
            frm.Show();
        }

        private void monthScheduleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MonthSche frm = new MonthSche();
            frm.MdiParent = this;
            frm.Show();
        }

        private void dayScheduleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            QuerySche frm = new QuerySche();
            frm.MdiParent = this;
            frm.Show();
        }

        private void loginToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Login frm = new Login();
            frm.MdiParent = this;
            frm.Show();
        }

        private void logoutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            uc.User = null;
            Form frm = this.ActiveMdiChild;
            MessageBox.Show("Logout success !");
            tsslUser.Text = "No Login";
            loginToolStripMenuItem.Enabled = true;
            logoutToolStripMenuItem.Enabled = false;            
            //atteKindtoolStripMenuItem.Enabled = false;
            //wageToolStripMenuItem.Enabled = false;
            Control[] ca = frm.Controls.Find("bindingNavigator1", true);
            if (ca.Length > 0)
            {
                ca[0].Enabled = false;
            }
            ca = frm.Controls.Find("dataGridView1", true);
            if (ca.Length > 0)
            {
                ((DataGridView)ca[0]).ReadOnly = true;
            }
            ca = frm.Controls.Find("btnSet", true);
            if (ca.Length > 0)
            {
                ca[0].Enabled = false;
            }
        }
    }
